package com.bawei.yangzongcai___chenmei.Adpter;

import android.widget.ImageView;

import com.bawei.yangzongcai___chenmei.JavaClass.JavaLianxi;
import com.bawei.yangzongcai___chenmei.R;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * create by ertu
 * create on 2021/7/13
 * description
 *
 */
public class QAQadpterActivity extends BaseMultiItemQuickAdapter<JavaLianxi.DataBean, BaseViewHolder> {


    public QAQadpterActivity(@Nullable List<JavaLianxi.DataBean> data) {
        super(data);
        addItemType(1,R.layout.yangchen1);
        addItemType(2,R.layout.yangchen2);
        addItemType(3,R.layout.yangchen3);
        addChildClickViewIds(R.id.yangchen3_text1);
        addChildClickViewIds(R.id.yangchen3_text3);
        addChildLongClickViewIds(R.id.yangchen3_img);
    }



    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, JavaLianxi.DataBean dataBean) {
        switch (dataBean.getItemType())
        {
            case 1:
                Glide.with(getContext()).load(dataBean.getUrl()).into((ImageView) baseViewHolder.getView(R.id.yangchen1_img1));
                Glide.with(getContext()).load(dataBean.getUrl()).into((ImageView) baseViewHolder.getView(R.id.yangchen1_img2));
                break;

            case 2:
                Glide.with(getContext()).load(dataBean.getUrl()).into((ImageView) baseViewHolder.getView(R.id.yangchen2_img1));
                Glide.with(getContext()).load(dataBean.getUrl()).into((ImageView) baseViewHolder.getView(R.id.yangchen2_img2));
                Glide.with(getContext()).load(dataBean.getUrl()).into((ImageView) baseViewHolder.getView(R.id.yangchen2_img3));
                Glide.with(getContext()).load(dataBean.getUrl()).into((ImageView) baseViewHolder.getView(R.id.yangchen2_img4));
                break;

            case 3:
                baseViewHolder.setText(R.id.yangchen3_text1,dataBean.getTitle());
                baseViewHolder.setText(R.id.yangchen3_text3,dataBean.getDesc());
                Glide.with(getContext()).load(dataBean.getUrl()).into((ImageView) baseViewHolder.getView(R.id.yangchen3_img));
                break;
        }
    }
}
